To add plugin to a page, we need to download plugin.js file and also include jQuery Library to the script block of the page. Below example we are going to make a slideshow effect using cycle plugin. It provides different options to have different transition effects and layouts.
Example:
<html>
<head>
<title> adding plugin toa page </title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.cycle/3.0.3/jquery.cycle.all.min.js"></script>
<script type="text/javascript">
(function ($) {
$(document).ready(function () {
$('.slider').cycle('fade');
});
})(jQuery);
</script>
<style type="text/css">
.slider img {
padding: 15px;
border: 1px solid #ccc;
background-color: #eee;
width: 500px;
height: 300px;
top: 0;
left: 0;
}
</style>
</head>
<body style="width: 600px">
<div class="slider">
<img src="images/hua001.jpg" alt="Beach 1" />
<img src="images/hua002.jpg" alt="Beach 2" />
<img src="images/hua003.jpg" alt="Beach 3" />
</div>
</body>
</html>
Output:
Post your comments / questions
Recent Article
- How to create custom 404 error page in Django?
- Requested setting INSTALLED_APPS, but settings are not configured. You must either define..
- ValueError:All arrays must be of the same length - Python
- Check hostname requires server hostname - SOLVED
- How to restrict access to the page Access only for logged user in Django
- Migration admin.0001_initial is applied before its dependency admin.0001_initial on database default
- Add or change a related_name argument to the definition for 'auth.User.groups' or 'DriverUser.groups'. -Django ERROR
- Addition of two numbers in django python
Related Article